package org.glut.saltedfish.service;


import org.glut.saltedfish.domain.Product;
import org.glut.saltedfish.mapper.ProductMapper;

import java.util.List;

public class ProductService {
    private final ProductMapper productMapper;

    public ProductService(ProductMapper productMapper) {
        this.productMapper = productMapper;
    }

    /**
     * 获取所有商品
     * @return 商品列表
     */
    public List<Product> getAllProducts() {
        return productMapper.findAllProducts();
    }

    /**
     * 查询商品
     * @param keyword
     * @return
     */
    public List<Product> searchProductsByTitle(String keyword) {
        return productMapper.searchByTitle(keyword);
    }
}